const jwt = require('jsonwebtoken');

function generateAccessToken(user) {
  return jwt.sign({ _id: user._id, username: user.username },'secret', { expiresIn: '1d' });
}

function generateRefreshToken(userId) {
  return jwt.sign({ userId },'secret', { expiresIn: '7d' });
}

module.exports = { generateAccessToken, generateRefreshToken };